/*
 * StartupCompanyManager2012View.java
 */
package startupcompanymanager2012;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * The application's main frame.
 */
public class StartupCompanyManager2012View extends FrameView {

    public StartupCompanyManager2012View(SingleFrameApplication app) {
        super(app);
        getFrame().setResizable(false);
        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String) (evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer) (evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });

        mProjectsButton.setEnabled(false);
        mStaffButton.setEnabled(false);
        mCompanyButton.setEnabled(false);
        cInfoButton.setEnabled(false);
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
            aboutBox = new StartupCompanyManager2012AboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        StartupCompanyManager2012App.getApplication().show(aboutBox);
        liveBudget.setText(Core.nfmt.format(Core.capital));

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        gamePanel = new javax.swing.JPanel();
        gameMainPanel = new javax.swing.JPanel();
        pathfinderPanel = new Pathfinder();
        gamePlayPanel = new javax.swing.JPanel();
        mStaffButton = new javax.swing.JButton();
        cInfoButton = new javax.swing.JButton();
        mProjectsButton = new javax.swing.JButton();
        mCompanyButton = new javax.swing.JButton();
        gameStatusPanel = new javax.swing.JPanel();
        livelDate = new javax.swing.JLabel();
        liveBudget = new javax.swing.JLabel();
        labelBudget = new javax.swing.JLabel();
        labelCompanyName = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        newgameMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        loadMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jToggleButton1 = new javax.swing.JToggleButton();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(startupcompanymanager2012.StartupCompanyManager2012App.class).getContext().getResourceMap(StartupCompanyManager2012View.class);
        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setMinimumSize(new java.awt.Dimension(600, 600));
        mainPanel.setName("mainPanel"); // NOI18N
        mainPanel.setPreferredSize(new java.awt.Dimension(600, 600));
        mainPanel.setLayout(new java.awt.BorderLayout());

        gamePanel.setName("gamePanel"); // NOI18N
        gamePanel.setLayout(new java.awt.BorderLayout());

        gameMainPanel.setBackground(resourceMap.getColor("gameMainPanel.background")); // NOI18N
        gameMainPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        gameMainPanel.setMaximumSize(new java.awt.Dimension(500, 455));
        gameMainPanel.setMinimumSize(new java.awt.Dimension(500, 455));
        gameMainPanel.setName("gameMainPanel"); // NOI18N
        gameMainPanel.setPreferredSize(new java.awt.Dimension(500, 455));

        pathfinderPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pathfinderPanel.setForeground(resourceMap.getColor("Pathfinder.foreground")); // NOI18N
        pathfinderPanel.setMaximumSize(new java.awt.Dimension(500, 500));
        pathfinderPanel.setMinimumSize(new java.awt.Dimension(500, 500));
        pathfinderPanel.setName("Pathfinder"); // NOI18N
        pathfinderPanel.setPreferredSize(new java.awt.Dimension(500, 500));

        javax.swing.GroupLayout pathfinderPanelLayout = new javax.swing.GroupLayout(pathfinderPanel);
        pathfinderPanel.setLayout(pathfinderPanelLayout);
        pathfinderPanelLayout.setHorizontalGroup(
            pathfinderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 498, Short.MAX_VALUE)
        );
        pathfinderPanelLayout.setVerticalGroup(
            pathfinderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 427, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout gameMainPanelLayout = new javax.swing.GroupLayout(gameMainPanel);
        gameMainPanel.setLayout(gameMainPanelLayout);
        gameMainPanelLayout.setHorizontalGroup(
            gameMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gameMainPanelLayout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addComponent(pathfinderPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(48, Short.MAX_VALUE))
        );
        gameMainPanelLayout.setVerticalGroup(
            gameMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gameMainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pathfinderPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 429, Short.MAX_VALUE)
                .addContainerGap())
        );

        gamePanel.add(gameMainPanel, java.awt.BorderLayout.CENTER);

        gamePlayPanel.setBackground(resourceMap.getColor("gamePlayPanel.background")); // NOI18N
        gamePlayPanel.setMaximumSize(new java.awt.Dimension(500, 100));
        gamePlayPanel.setMinimumSize(new java.awt.Dimension(500, 100));
        gamePlayPanel.setName("gamePlayPanel"); // NOI18N
        gamePlayPanel.setPreferredSize(new java.awt.Dimension(500, 100));

        mStaffButton.setIcon(resourceMap.getIcon("mStaffButton.icon")); // NOI18N
        mStaffButton.setText(resourceMap.getString("mStaffButton.text")); // NOI18N
        mStaffButton.setToolTipText(resourceMap.getString("mStaffButton.toolTipText")); // NOI18N
        mStaffButton.setActionCommand(resourceMap.getString("mStaffButton.actionCommand")); // NOI18N
        mStaffButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), resourceMap.getString("mStaffButton.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, resourceMap.getFont("mStaffButton.border.titleFont"))); // NOI18N
        mStaffButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        mStaffButton.setMaximumSize(new java.awt.Dimension(119, 109));
        mStaffButton.setMinimumSize(new java.awt.Dimension(119, 109));
        mStaffButton.setName("mStaffButton"); // NOI18N
        mStaffButton.setPreferredSize(new java.awt.Dimension(119, 109));
        mStaffButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showDevs(evt);
            }
        });

        cInfoButton.setIcon(resourceMap.getIcon("cInfoButton.icon")); // NOI18N
        cInfoButton.setText(resourceMap.getString("cInfoButton.text")); // NOI18N
        cInfoButton.setToolTipText(resourceMap.getString("cInfoButton.toolTipText")); // NOI18N
        cInfoButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("cInfoButton.border.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, resourceMap.getFont("cInfoButton.border.border.titleFont")), "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("cInfoButton.border.titleFont"))); // NOI18N
        cInfoButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cInfoButton.setMaximumSize(new java.awt.Dimension(119, 109));
        cInfoButton.setMinimumSize(new java.awt.Dimension(119, 109));
        cInfoButton.setName("cInfoButton"); // NOI18N
        cInfoButton.setPreferredSize(new java.awt.Dimension(119, 109));
        cInfoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showCInfo(evt);
            }
        });

        mProjectsButton.setIcon(resourceMap.getIcon("mProjectsButton.icon")); // NOI18N
        mProjectsButton.setText(resourceMap.getString("mProjectsButton.text")); // NOI18N
        mProjectsButton.setToolTipText(resourceMap.getString("mProjectsButton.toolTipText")); // NOI18N
        mProjectsButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), resourceMap.getString("mProjectsButton.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, resourceMap.getFont("mProjectsButton.border.titleFont"))); // NOI18N
        mProjectsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        mProjectsButton.setName("mProjectsButton"); // NOI18N
        mProjectsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showProjectManager(evt);
            }
        });

        mCompanyButton.setIcon(resourceMap.getIcon("mCompanyButton.icon")); // NOI18N
        mCompanyButton.setText(resourceMap.getString("mCompanyButton.text")); // NOI18N
        mCompanyButton.setToolTipText(resourceMap.getString("mCompanyButton.toolTipText")); // NOI18N
        mCompanyButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), resourceMap.getString("mCompanyButton.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, resourceMap.getFont("mCompanyButton.border.titleFont"))); // NOI18N
        mCompanyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        mCompanyButton.setMaximumSize(new java.awt.Dimension(119, 109));
        mCompanyButton.setMinimumSize(new java.awt.Dimension(119, 109));
        mCompanyButton.setName("mCompanyButton"); // NOI18N
        mCompanyButton.setPreferredSize(new java.awt.Dimension(119, 109));

        javax.swing.GroupLayout gamePlayPanelLayout = new javax.swing.GroupLayout(gamePlayPanel);
        gamePlayPanel.setLayout(gamePlayPanelLayout);
        gamePlayPanelLayout.setHorizontalGroup(
            gamePlayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gamePlayPanelLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addComponent(mProjectsButton)
                .addGap(18, 18, 18)
                .addComponent(mStaffButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(mCompanyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(cInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(279, 279, 279))
        );
        gamePlayPanelLayout.setVerticalGroup(
            gamePlayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gamePlayPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(gamePlayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(mCompanyButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(mStaffButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(mProjectsButton, 0, 0, Short.MAX_VALUE))
                .addContainerGap())
        );

        gamePanel.add(gamePlayPanel, java.awt.BorderLayout.SOUTH);

        gameStatusPanel.setBackground(resourceMap.getColor("gameStatusPanel.background")); // NOI18N
        gameStatusPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, resourceMap.getColor("gameStatusPanel.border.highlightOuterColor"), resourceMap.getColor("gameStatusPanel.border.highlightInnerColor"), resourceMap.getColor("gameStatusPanel.border.shadowOuterColor"), resourceMap.getColor("gameStatusPanel.border.shadowInnerColor"))); // NOI18N
        gameStatusPanel.setAutoscrolls(true);
        gameStatusPanel.setMaximumSize(new java.awt.Dimension(500, 45));
        gameStatusPanel.setMinimumSize(new java.awt.Dimension(500, 45));
        gameStatusPanel.setName("gameStatusPanel"); // NOI18N
        gameStatusPanel.setPreferredSize(new java.awt.Dimension(500, 45));

        livelDate.setFont(resourceMap.getFont("livelDate.font")); // NOI18N
        livelDate.setText(resourceMap.getString("livelDate.text")); // NOI18N
        livelDate.setName("livelDate"); // NOI18N

        liveBudget.setFont(resourceMap.getFont("liveBudget.font")); // NOI18N
        liveBudget.setText(resourceMap.getString("liveBudget.text")); // NOI18N
        liveBudget.setName("liveBudget"); // NOI18N

        labelBudget.setFont(resourceMap.getFont("labelBudget.font")); // NOI18N
        labelBudget.setText(resourceMap.getString("labelBudget.text")); // NOI18N
        labelBudget.setName("labelBudget"); // NOI18N

        labelCompanyName.setFont(resourceMap.getFont("labelCompanyName.font")); // NOI18N
        labelCompanyName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        labelCompanyName.setText(resourceMap.getString("labelCompanyName.text")); // NOI18N
        labelCompanyName.setDoubleBuffered(true);
        labelCompanyName.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        labelCompanyName.setName("labelCompanyName"); // NOI18N

        javax.swing.GroupLayout gameStatusPanelLayout = new javax.swing.GroupLayout(gameStatusPanel);
        gameStatusPanel.setLayout(gameStatusPanelLayout);
        gameStatusPanelLayout.setHorizontalGroup(
            gameStatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gameStatusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(livelDate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 175, Short.MAX_VALUE)
                .addComponent(labelCompanyName)
                .addGap(110, 110, 110)
                .addComponent(labelBudget)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(liveBudget, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        gameStatusPanelLayout.setVerticalGroup(
            gameStatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gameStatusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(gameStatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelBudget)
                    .addComponent(liveBudget)
                    .addComponent(livelDate)
                    .addComponent(labelCompanyName))
                .addContainerGap())
        );

        gamePanel.add(gameStatusPanel, java.awt.BorderLayout.PAGE_START);

        mainPanel.add(gamePanel, java.awt.BorderLayout.CENTER);

        menuBar.setMaximumSize(new java.awt.Dimension(60, 21));
        menuBar.setMinimumSize(new java.awt.Dimension(60, 21));
        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        newgameMenuItem.setText(resourceMap.getString("newgameMenuItem.text")); // NOI18N
        newgameMenuItem.setName("newgameMenuItem"); // NOI18N
        newgameMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startNewGame(evt);
            }
        });
        fileMenu.add(newgameMenuItem);

        saveMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        saveMenuItem.setText(resourceMap.getString("saveMenuItem.text")); // NOI18N
        saveMenuItem.setName("saveMenuItem"); // NOI18N
        fileMenu.add(saveMenuItem);

        loadMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        loadMenuItem.setText(resourceMap.getString("loadMenuItem.text")); // NOI18N
        loadMenuItem.setName("loadMenuItem"); // NOI18N
        fileMenu.add(loadMenuItem);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(startupcompanymanager2012.StartupCompanyManager2012App.class).getContext().getActionMap(StartupCompanyManager2012View.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setMaximumSize(new java.awt.Dimension(500, 25));
        statusPanel.setMinimumSize(new java.awt.Dimension(500, 25));
        statusPanel.setName("statusPanel"); // NOI18N
        statusPanel.setPreferredSize(new java.awt.Dimension(500, 25));

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 580, Short.MAX_VALUE)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addGap(358, 358, 358)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(96, Short.MAX_VALUE))
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(statusMessageLabel)
                            .addComponent(statusAnimationLabel))
                        .addGap(3, 3, 3))
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jToggleButton1.setText(resourceMap.getString("jToggleButton1.text")); // NOI18N
        jToggleButton1.setName("jToggleButton1"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    private void showDevs(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showDevs
        JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
        devBox = new StartupCompanyManager2012DevManager();
        devBox.setLocationRelativeTo(mainFrame);
        StartupCompanyManager2012App.getApplication().show(devBox);
        liveBudget.setText(Core.nfmt.format(Core.capital));
    }//GEN-LAST:event_showDevs

    private void startNewGame(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startNewGame
        if (Core.running == true) {
            JOptionPane.showMessageDialog(null, "You allready have a game running!");
        } else {
            JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
            newGameBox = new StartupCompanyManager2012newGame();
            newGameBox.setLocationRelativeTo(mainFrame);
            StartupCompanyManager2012App.getApplication().show(newGameBox);
        }

    }//GEN-LAST:event_startNewGame

    private void showCInfo(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCInfo
        JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
        compInfoBox = new StartupCompanyManager2012CInfo();
        compInfoBox.setLocationRelativeTo(mainFrame);
        StartupCompanyManager2012App.getApplication().show(compInfoBox);
    }//GEN-LAST:event_showCInfo

    private void showProjectManager(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showProjectManager


        JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
        projectManager = new StartupCompanyManager2012ProjectManager();
        projectManager.setLocationRelativeTo(mainFrame);
        StartupCompanyManager2012App.getApplication().show(projectManager);

    }//GEN-LAST:event_showProjectManager
    public static void updateBudgetLabel() {
        liveBudget.setText(Core.nfmt.format(Core.capital));
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JButton cInfoButton;
    private javax.swing.JPanel gameMainPanel;
    private javax.swing.JPanel gamePanel;
    private javax.swing.JPanel gamePlayPanel;
    private javax.swing.JPanel gameStatusPanel;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JLabel labelBudget;
    public static javax.swing.JLabel labelCompanyName;
    public static javax.swing.JLabel liveBudget;
    public static javax.swing.JLabel livelDate;
    private javax.swing.JMenuItem loadMenuItem;
    public static javax.swing.JButton mCompanyButton;
    public static javax.swing.JButton mProjectsButton;
    public static javax.swing.JButton mStaffButton;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem newgameMenuItem;
    private javax.swing.JPanel pathfinderPanel;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JMenuItem saveMenuItem;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JFrame devBox;
    private JFrame newGameBox;
    private JFrame compInfoBox;
    private JFrame projectManager;
    private JDialog aboutBox;
}
